#include <bits/stdc++.h>
#define endl '\n'
using namespace std;

const int TEST_CASES = 25;
random_device rd;
mt19937 gen(rd());

// 生成测试用例
void test(int testCase, ofstream& fout) {
    if (testCase == 1) {
        // 样例1
        fout << "6 5\n";
        fout << "4 7 10 6 5\n";
    } else if (testCase == 2) {
        // 样例2
        fout << "6 5\n";
        fout << "4 7 8 6 5\n";
    } else if (testCase == 3) {
        // 边界情况：N=0
        fout << "5 0\n";
    } else if (testCase == 4) {
        // 边界情况：X在序列中
        fout << "5 3\n";
        fout << "1 2 5\n";
    } else if (testCase == 5) {
        // 边界情况：X不在序列中
        fout << "5 3\n";
        fout << "1 2 3\n";
    } else if (testCase <= 10) {
        // 小规模随机数据
        int X = uniform_int_distribution<int>(-10, 10)(gen);
        int N = uniform_int_distribution<int>(1, 10)(gen);
        fout << X << " " << N << "\n";
        for (int i = 0; i < N; i++) {
            int val = uniform_int_distribution<int>(-10, 10)(gen);
            fout << val << " ";
        }
        fout << "\n";
    } else if (testCase <= 15) {
        // 中等规模数据
        int X = uniform_int_distribution<int>(-100, 100)(gen);
        int N = uniform_int_distribution<int>(10, 50)(gen);
        fout << X << " " << N << "\n";
        for (int i = 0; i < N; i++) {
            int val = uniform_int_distribution<int>(-100, 100)(gen);
            fout << val << " ";
        }
        fout << "\n";
    } else if (testCase <= 20) {
        // 大规模数据
        int X = uniform_int_distribution<int>(-1000, 1000)(gen);
        int N = uniform_int_distribution<int>(50, 100)(gen);
        fout << X << " " << N << "\n";
        for (int i = 0; i < N; i++) {
            int val = uniform_int_distribution<int>(-1000, 1000)(gen);
            fout << val << " ";
        }
        fout << "\n";
    } else {
        // 特殊情况测试
        if (testCase == 21) {
            // 最大值测试
            fout << "1000000000 1\n";
            fout << "1\n";
        } else if (testCase == 22) {
            // 最小值测试
            fout << "-1000000000 1\n";
            fout << "-1\n";
        } else if (testCase == 23) {
            // 全部相同
            fout << "5 5\n";
            fout << "5 5 5 5 5\n";
        } else if (testCase == 24) {
            // 排序后相邻
            fout << "5 5\n";
            fout << "1 2 3 4 6\n";
        } else {
            // 完全随机
            int X = uniform_int_distribution<int>(-1000000, 1000000)(gen);
            int N = uniform_int_distribution<int>(1, 100000)(gen);
            fout << X << " " << N << "\n";
            for (int i = 0; i < N; i++) {
                int val = uniform_int_distribution<int>(-1000000, 1000000)(gen);
                fout << val << " ";
            }
            fout << "\n";
        }
    }
}